﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace 适配器模式_篮球翻译
{
    abstract class Player
    {
        protected string name = string.Empty;
        public Player(string name)
        {
            this.name = name;
        }

        public abstract void Attack();
        public abstract void Defense();
    }

    class Forwards : Player
    {
        public Forwards(string name) : base(name)
        { }

        public override void Attack()
        {
            Console.WriteLine("前锋 {0} 进攻",name);
        }

        public override void Defense()
        {
             Console.WriteLine("前锋 {0} 防守",name);          
        }
    }

    class Center : Player
    {
        public Center(string name): base(name)
        { }

        public override void Attack()
        {
            Console.WriteLine("中锋 {0} 进攻",name);
        }

        public override void Defense()
        {
             Console.WriteLine("中锋 {0} 防守",name);          
        }
    }

    class Guards : Player
    {
        public Guards(string name) : base(name)
        { }

        public override void Attack()
        {
            Console.WriteLine("后卫 {0} 进攻",name);
        }

        public override void Defense()
        {
             Console.WriteLine("后卫 {0} 防守",name);          
        }
    }

    class Translator : Player
    {
        ForignCenter wjzf;
        public Translator(string name): base(name)
        { 
            wjzf = new ForignCenter(name);
        }

        public override void Attack()
        {
            wjzf.进攻();
        }

        public override void Defense()
        {
            wjzf.防守();
        }
    }

    class ForignCenter
    {
        private string _name;
        public string name
        {
            get { return _name; }
        }

        public ForignCenter(string name)
        {
            this._name = name;
        }

        public void 进攻()
        {
            Console.WriteLine("外籍中锋 {0} 进攻", name);
        }

        public void 防守()
        {
            Console.WriteLine("外籍中锋 {0} 防守", name);    
        }
    }

}
